﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualBasic.FileIO;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
using System.Collections;
using System.Drawing;
using System.Windows.Controls.Primitives;
using System.Windows.Threading;

using MediaLibrary.Controls;

using AMPLibrary;
using AMPLibrary.Collections;
using AMPLibrary.Controllers;
using AMPLibrary.Media;

namespace MediaLibrary
{
    /// <summary>
    /// Interaction logic for MusicPage.xaml
    /// </summary>
    public partial class MusicPage : Page
    {
        // singleton instance of the music page
        private static MusicPage musicPage;

        // get the instance of the music collection
        private MusicCollection musicCollection = MusicCollection.GetMusicCollection();

        // get the instance of the watch folder controller
        private WatchFolderController watchFolderController = WatchFolderController.GetWatchFolderController();

        // get the now playing list
        private NowPlayingCollection npc = NowPlayingCollection.GetNowPlayingCollection();

        // an object that holds the default node in the tree view object
        private object defaultNode = null;

        /// <summary>
        /// Constructor, private, creates an instance of the object
        /// </summary>
        private MusicPage()
        {
            InitializeComponent();
            BindContent();

            watchFolderController.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(watchFolderController_PropertyChanged);
            watchFolderController.MusicScanComplete += new WatchFolderController.MusicScanCompleteEventHandler(watchFolderController_MusicScanComplete);
            musicTreeView.SelectedItemChanged += new RoutedPropertyChangedEventHandler<object>(musicTreeView_SelectedItemChanged);
        }

        /// <summary>
        /// Method, Singleton contructor, gets the copy of the Music Page
        /// </summary>
        /// <returns></returns>
        public static MusicPage GetMusicPage()
        {
            if (musicPage == null)
                musicPage = new MusicPage();

            return musicPage;
        }

#region Global

        /// <summary>
        /// Method, stops the music folder controller from scanning while the page is reading from the collection
        /// </summary>
        private void Pause()
        {
            watchFolderController.PauseMusic = true;
            System.Threading.Thread.Sleep(100);
        }

        /// <summary>
        /// Method, tells the music folder controller to resume scanning
        /// </summary>
        private void Unpause()
        {
            watchFolderController.PauseMusic = false;
        }

        /// <summary>
        /// Method, binds the content to the Music Page controls
        /// </summary>
        private void BindContent()
        {
            Pause();

            this.artistListBox.SelectedIndex = -1;
            this.albumListBox2.SelectedIndex = -1;
            this.trackListBox3.SelectedIndex = -1;
            this.yearListBox4.SelectedIndex = -1;
            this.genreListBox5.SelectedIndex = -1;
            this.trackListBox7.SelectedIndex = -1;

            /******************** 1 *********************/
            try
            {
                this.artistListBox.ItemsSource = (from artist in musicCollection orderby artist.Tag.AlbumArtist select artist).Distinct(new MediaArtistEqualityComparer());

                if (this.artistListBox.Items.Count > 0)
                    this.artistListBox.SelectedIndex = 0;
            }
            catch
            {

            }

            /******************** 2 *********************/
            try
            {
                this.albumListBox2.ItemsSource = (from album in musicCollection orderby album.Tag.Album select album).Distinct(new MediaAlbumEqualityComparer());

                if (this.albumListBox2.Items.Count > 0)
                    this.albumListBox2.SelectedIndex = 0;
            }
            catch
            {

            }

            /******************** 3 *********************/
            try
            {
                this.trackListBox3.ItemsSource = (from song in musicCollection orderby song.Tag.AlbumArtist, song.Tag.Album, song.Tag.Track, song.Tag.Title select song);

                if (this.trackListBox3.Items.Count > 0)
                    this.trackListBox3.SelectedIndex = 0;
            }
            catch
            {

            }

            /******************** 4 *********************/
            try
            {
                this.yearListBox4.ItemsSource = (from year in musicCollection orderby year.Tag.Year select year).Distinct(new MediaYearEqualityComparer());

                if (this.yearListBox4.Items.Count > 0)
                    this.yearListBox4.SelectedIndex = 0;
            }
            catch
            {

            }

            /******************** 5 *********************/
            try
            {
                this.genreListBox5.ItemsSource = (from year in musicCollection orderby year.Tag.Genre select year).Distinct(new MediaGenreEqualityComparer());

                if (this.genreListBox5.Items.Count > 0)
                    this.genreListBox5.SelectedIndex = 0;
            }
            catch
            {
            }

            /*** 6 is the folder view tree ***/

            /******************** 7 *********************/
            try
            {
                this.trackListBox7.ItemsSource = (from song in musicCollection orderby song.DateAdded descending select song).Take(255);

                if (this.trackListBox7.Items.Count > 0)
                    this.trackListBox7.SelectedIndex = 0;
            }
            catch
            {

            }

            /******************** stats *********************/
            try
            {
                this.artistCounterLabel.Content = "Artists: " + this.artistListBox.Items.Count.ToString();
            }
            catch
            {
            }
            
            try
            {
                this.albumCounterLabel.Content = "Albums: " + this.albumListBox2.Items.Count.ToString();
            }
            catch
            {
            }
            
            try
            {
                this.trackCounterLabel.Content = "Tracks: " + this.trackListBox3.Items.Count.ToString();
            }
            catch
            {
            }
            
            try
            {
                this.genreCounterLabel.Content = "Genres: " + this.genreListBox5.Items.Count.ToString();
            }
            catch
            {
            }
            
            BuildTree();

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void refreshButton_Click(object sender, RoutedEventArgs e)
        {
            BindContent();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void watchFolderController_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "CurrentMusicFolder")
                this.currentlyScanning.Content = watchFolderController.CurrentMusicFolder;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void watchFolderController_MusicScanComplete(object sender, EventArgs e)
        {
            BindContent();
        }

#endregion

#region Artist

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void artistListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pause();

            if (this.artistListBox.SelectedItems == null)
                return;

            Collection<MediaFile> tempAlbums = new Collection<MediaFile>();
            Collection<MediaFile> tempSongs = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.artistListBox.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                foreach(MediaFile item in (from album in musicCollection where album.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist select album).Distinct(new MediaAlbumEqualityComparer()))
                    tempAlbums.AddItem(item);
            }

            this.albumListBox.ItemsSource = tempAlbums.Distinct();

            if (this.albumListBox.Items.Count > 0)
                this.albumListBox.SelectedIndex = 0;

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void albumListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pause();

            if (this.albumListBox.SelectedItems == null)
                return;

            Collection<MediaFile> selectedItems = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.albumListBox.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                foreach(MediaFile item in new Collection<MediaFile>(from song in musicCollection where song.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist && song.Tag.Album == selectedMedia.Tag.Album select song).Distinct())
                    selectedItems.AddItem(item);
            }
            
            this.trackListBox.ItemsSource = selectedItems.Distinct();
            this.trackListBox.SelectedItem = null;

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trackListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingArtist_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.artistListBox.SelectedItems == null)
                return;
            
            foreach (MediaFile selectedMedia in this.artistListBox.SelectedItems)
            {
                if (selectedMedia == null)
                    return;
                                
                npc.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist select a));
            }

            Unpause();
        }

        /// <summary>
        /// Event Handler, fired when the user wants to replace the now playing list with the artist
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingArtist_OnClick(object sender, RoutedEventArgs e)
        {
            // pause the scanner so the list cant be dated
            Pause();

            if (this.artistListBox.SelectedItems == null)
                return;

            npc.ClearItems();

            foreach (MediaFile selectedMedia in this.artistListBox.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                npc.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist select a));
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingAlbum_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox.SelectedItems == null)
                return;

            foreach (MediaFile selectedMedia in this.albumListBox.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                npc.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist && a.Tag.Album == selectedMedia.Tag.Album select a));
            }

            Unpause();
        }

        /// <summary>
        /// Event Handler, fired when the user wants to replace the now playing list with the current selected album(s)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingAlbum_OnClick(object sender, RoutedEventArgs e)
        {
            // pause the music library scanning process
            Pause();

            // make sure things arent null
            if (this.albumListBox.SelectedItems == null)
                return;

            npc.ClearItems();

            // for each selected album get the media to add
            foreach (MediaFile selectedMedia in this.albumListBox.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                npc.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist && a.Tag.Album == selectedMedia.Tag.Album select a));
            }

            // restart the scanning process
            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingTrack_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox.SelectedItems == null)
                return;

            foreach (MediaFile selectedMedia in this.trackListBox.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                npc.AddItem(selectedMedia);
            }

            Unpause();
        }

        /// <summary>
        /// Event handler, fired when the user wants to replace the now playing list with the currently selected tracks
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingTrack_OnClick(object sender, RoutedEventArgs e)
        {
            // pause the music scanning process
            Pause();

            if (this.trackListBox.SelectedItems == null)
                return;

            // clear the now playing list
            npc.ClearItems();

            // for each selected media item
            foreach (MediaFile selectedMedia in this.trackListBox.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                npc.AddItem(selectedMedia);
            }

            // restart the scanning process
            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistArtist_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>(from m in musicCollection where ((MediaFile)artistListBox.SelectedItem).Tag.AlbumArtist == m.Tag.AlbumArtist select m);

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistArtist_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.artistListBox.SelectedItems == null)
                return;

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            if (this.artistListBox.SelectedItems.Count < 1)
                return;

            foreach (MediaFile selectedMedia in this.artistListBox.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                foreach (MediaFile item in (from a in musicCollection where a.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist select a))
                    newPlaylistMedia.AddItem(item);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistAlbum_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;

                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile media in this.albumListBox.SelectedItems)
                {
                    foreach (MediaFile item in (from m in musicCollection where m.Tag.Album == media.Tag.Album select m))
                        mediaCollection.AddItem(item);
                }

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistAlbum_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox.SelectedItems == null)
                return;

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            if (this.artistListBox.SelectedItems.Count < 1)
                return;

            foreach (MediaFile selectedMedia in this.albumListBox.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                foreach (MediaFile item in (from a in musicCollection where a.Tag.Album == selectedMedia.Tag.Album select a))
                    newPlaylistMedia.AddItem(item);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistTrack_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (trackListBox.SelectedItems == null)
                return;

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;
                
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile media in trackListBox.SelectedItems)
                    mediaCollection.AddItem(media);

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistTrack_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.artistListBox.SelectedItems == null)
                return;

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            if (this.artistListBox.SelectedItems.Count < 1)
                return;

            foreach (MediaFile selectedMedia in this.trackListBox.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                newPlaylistMedia.AddItem(selectedMedia);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryArtist_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.artistListBox.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in artistListBox.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Tag.AlbumArtist == media.Tag.AlbumArtist select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                        emc.AddItem(media.Path);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerArtist_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.artistListBox.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in artistListBox.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Tag.AlbumArtist == media.Tag.AlbumArtist select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryAlbum_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile artistItem in artistListBox.SelectedItems)
                {
                    foreach (MediaFile item in albumListBox.SelectedItems)
                    {
                        Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where media.Tag.Album == item.Tag.Album && media.Tag.AlbumArtist == artistItem.Tag.AlbumArtist select media);

                        foreach (MediaFile media in selectedMedia)
                        {
                            musicCollection.RemoveItem(media);
                            ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                            emc.AddItem(media.Path);
                        }
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerAlbum_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile artistItem in artistListBox.SelectedItems)
                {
                    foreach (MediaFile item in albumListBox.SelectedItems)
                    {
                        Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where media.Tag.Album == item.Tag.Album && media.Tag.AlbumArtist == artistItem.Tag.AlbumArtist select media);

                        foreach (MediaFile media in selectedMedia)
                        {
                            musicCollection.RemoveItem(media);
                            FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                        }
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryTrack_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in this.trackListBox.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Path == media.Path select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                        emc.AddItem(media.Path);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerTrack_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in trackListBox.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Path == media.Path select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    }
                }

                BindContent();
            }

            Unpause();
        }

#endregion

#region ArtistTag

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void editArtistInformation_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.artistListBox.SelectedItems == null)
                return;

            Collection<MediaFile> mediaToEdit = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.artistListBox.SelectedItems)
            {
                foreach (MediaFile item in (from a in musicCollection where a.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist select a))
                    mediaToEdit.AddItem(item);
            }

            ArtistTagEditorWindow atew = new ArtistTagEditorWindow(mediaToEdit);
            if (atew.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editAlbumInformation_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox.SelectedItems == null)
                return;

            Collection<MediaFile> editAlbumMedia = new Collection<MediaFile>();

            if (this.artistListBox.SelectedItems.Count < 1)
                return;

            foreach (MediaFile artistMedia in this.artistListBox.SelectedItems)
            {
                foreach (MediaFile albumMedia in this.albumListBox.SelectedItems)
                {
                    foreach (MediaFile item in (from a in musicCollection where a.Tag.AlbumArtist == artistMedia.Tag.AlbumArtist && a.Tag.Album == albumMedia.Tag.Album select a))
                        editAlbumMedia.AddItem(item);
                }
            }

            AlbumTagEditorWindow ate = new AlbumTagEditorWindow(editAlbumMedia);
            if (ate.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

        private void editTrackInformation_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox.SelectedItems == null)
                return;

            Collection<MediaFile> editAlbumMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.trackListBox.SelectedItems)
                editAlbumMedia.AddItem(selectedMedia);

            SongTagEditorWindow stew = new SongTagEditorWindow(editAlbumMedia);
            if (stew.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

#endregion

#region Album

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void albumListBox2_SelectionChanged(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox2.SelectedItems == null)
                return;

            Collection<MediaFile> selectedItems = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.albumListBox2.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                foreach (MediaFile item in (from song in musicCollection where song.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist && song.Tag.Album == selectedMedia.Tag.Album select song).Distinct())
                    selectedItems.AddItem(item);
            }

            this.trackListBox2.ItemsSource = selectedItems;
            this.trackListBox2.SelectedItem = null;

            Unpause();
        }

        /// <summary>
        /// Event handler, fired when the user wants to add to the now playing list with the current selected album(s)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingAlbum2_OnClick(object sender, RoutedEventArgs e)
        {
            // stop the scanning process
            Pause();

            // make sure something is selected
            if (this.albumListBox2.SelectedItems == null)
                return;

            // add the selected albums
            foreach (MediaFile selectedMedia in this.albumListBox2.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                npc.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist && a.Tag.Album == selectedMedia.Tag.Album select a));
            }

            // resume the scanning process
            Unpause();
        }

        /// <summary>
        /// Event handler, fired when the user wants to replace the now playing list with the current selected album(s)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingAlbum2_OnClick(object sender, RoutedEventArgs e)
        {
            // stop the scanning process
            Pause();

            // make sure something is selected
            if (this.albumListBox2.SelectedItems == null)
                return;

            // get the now playing list and clear it
            npc.ClearItems();

            // add the selected albums
            foreach (MediaFile selectedMedia in this.albumListBox2.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                npc.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist && a.Tag.Album == selectedMedia.Tag.Album select a));
            }

            // resume the scanning process
            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistAlbum2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox2.SelectedItems == null)
                return;

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.albumListBox2.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                foreach (MediaFile item in (from a in musicCollection where a.Tag.Album == selectedMedia.Tag.Album select a))
                    newPlaylistMedia.AddItem(item);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistAlbum2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;

                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile media in this.albumListBox2.SelectedItems)
                {
                    foreach (MediaFile item in (from m in musicCollection where m.Tag.Album == media.Tag.Album select m))
                        mediaCollection.AddItem(item);
                }

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistTrack2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (trackListBox2.SelectedItems == null)
                return;

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;

                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile media in trackListBox2.SelectedItems)
                    mediaCollection.AddItem(media);

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistTrack2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox2.SelectedItems.Count < 1)
                return;

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.trackListBox2.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                newPlaylistMedia.AddItem(selectedMedia);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingTrack2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox2.SelectedItems == null)
                return;

            foreach (MediaFile selectedMedia in this.trackListBox2.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                npc.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Path == selectedMedia.Path select a));
            }

            Unpause();
        }

        /// <summary>
        /// Event Handler, fired when the user wants to replace the now playing list with the currently selected tracks
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void replaceNowPlayingTrack2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox2.SelectedItems == null)
                return;

            npc.ClearItems();

            foreach (MediaFile selectedMedia in this.trackListBox2.SelectedItems)
                npc.AddItem(selectedMedia);

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryAlbum2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox2.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in this.albumListBox2.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Tag.Album == media.Tag.Album select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                        emc.AddItem(media.Path);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerAlbum2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox2.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in albumListBox2.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Tag.Album == media.Tag.Album select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryTrack2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox2.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in this.trackListBox2.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Path == media.Path select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                        emc.AddItem(media.Path);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerTrack2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox2.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in trackListBox2.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Path == media.Path select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    }
                }

                BindContent();
            }

            Unpause();
        }

#endregion

#region AlbumTag

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editAlbumInformation2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox.SelectedItems == null)
                return;

            Collection<MediaFile> editAlbumMedia = new Collection<MediaFile>();

            foreach (MediaFile albumMedia in this.albumListBox2.SelectedItems)
            {
                foreach (MediaFile item in (from song in musicCollection where song.Tag.Album == albumMedia.Tag.Album select song).Distinct())
                    editAlbumMedia.AddItem(item);
            }

            AlbumTagEditorWindow ate = new AlbumTagEditorWindow(editAlbumMedia);
            if (ate.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editTrackInformation2_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox2.SelectedItems == null)
                return;

            Collection<MediaFile> editAlbumMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.trackListBox2.SelectedItems)
            {
                editAlbumMedia.AddItem(selectedMedia);
            }

            SongTagEditorWindow stew = new SongTagEditorWindow(editAlbumMedia);
            if (stew.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

#endregion

#region Song

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trackListBox3_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingTrack3_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox3.SelectedItems == null)
                return;

            foreach (MediaFile selectedMedia in this.trackListBox3.SelectedItems)
                npc.AddItem(selectedMedia);

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingTrack3_OnClick(object sender, RoutedEventArgs e)
        {
            if (this.trackListBox3.SelectedItems == null)
                return;

            Pause();

            npc.ClearItems();

            foreach (MediaFile selectedMedia in this.trackListBox3.SelectedItems)
                npc.AddItem(selectedMedia);

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistTrack3_OnClick(object sender, RoutedEventArgs e)
        {
            if (trackListBox3.SelectedItems == null)
                return;

            Pause();

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;

                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile media in trackListBox3.SelectedItems)
                    mediaCollection.AddItem(media);

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistTrack3_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.trackListBox3.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                newPlaylistMedia.AddItem(selectedMedia);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryTrack3_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox3.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in this.trackListBox3.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Path == media.Path select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                        emc.AddItem(media.Path);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerTrack3_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox3.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in trackListBox3.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Path == media.Path select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    }
                }

                BindContent();
            }

            Unpause();
        }

#endregion

#region SongTag

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editTrackInformation3_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox3.SelectedItems == null)
                return;

            Collection<MediaFile> editAlbumMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.trackListBox3.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                editAlbumMedia.AddItem(selectedMedia);
            }

            SongTagEditorWindow stew = new SongTagEditorWindow(editAlbumMedia);
            if (stew.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

#endregion

#region Year

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void yearListBox4_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            Collection<MediaFile> media = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.yearListBox4.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                foreach (MediaFile item in (from artist in musicCollection where artist.Tag.Year == selectedMedia.Tag.Year select artist).Distinct(new MediaArtistEqualityComparer()))
                    media.AddItem(item);
            }

            this.artistListBox4.ItemsSource = media;

            if (this.artistListBox4.Items.Count > 0)
                this.artistListBox4.SelectedIndex = 0;

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void artistListBox4_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pause();

            if (this.artistListBox4.SelectedItems == null)
                return;

            Collection<MediaFile> selectedItems = new Collection<MediaFile>();

            foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox4.SelectedItems)
                {
                    foreach (MediaFile item in (from artist in musicCollection where artist.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && artist.Tag.Year == selectedYear.Tag.Year select artist).Distinct(new MediaAlbumEqualityComparer()))
                        selectedItems.AddItem(item);
                }
            }

            this.albumListBox4.ItemsSource = selectedItems;

            if (this.albumListBox4.Items.Count > 0)
                this.albumListBox4.SelectedIndex = 0;

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void albumListBox4_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pause();

            if (this.albumListBox4.SelectedItems == null)
                return;

            Collection<MediaFile> selectedItems = new Collection<MediaFile>();

            foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox4.SelectedItems)
                {
                    foreach (MediaFile selectedAlbum in this.albumListBox4.SelectedItems)
                    {
                        foreach (MediaFile item in (from song in musicCollection where song.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && song.Tag.Album == selectedAlbum.Tag.Album && song.Tag.Year == selectedYear.Tag.Year select song).Distinct())
                            selectedItems.AddItem(item);
                    }
                }
            }
            
            this.trackListBox4.ItemsSource = selectedItems;

            if (this.trackListBox4.Items.Count > 0)
                this.trackListBox4.SelectedIndex = 0;

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trackListBox4_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistYear4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (trackListBox3.SelectedItems == null)
                return;

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;

                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile selectedMedia in this.yearListBox4.SelectedItems)
                {
                    var mediaItems = (from media in musicCollection where media.Tag.Year == selectedMedia.Tag.Year select media);

                    foreach (MediaFile item in mediaItems)
                        mediaCollection.AddItem(item);
                }

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistYear4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.yearListBox4.SelectedItems)
            {
                var mediaItems = (from media in musicCollection where media.Tag.Year == selectedMedia.Tag.Year select media);

                foreach(MediaFile item in mediaItems)
                    newPlaylistMedia.AddItem(item);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingYear4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            foreach (MediaFile selectedMedia in this.yearListBox4.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                npc.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.Year == selectedMedia.Tag.Year select a));
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingYear4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            npc.ClearItems();

            foreach (MediaFile selectedMedia in this.yearListBox4.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                npc.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.Year == selectedMedia.Tag.Year select a));
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryYear4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in this.yearListBox4.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Tag.Year == media.Tag.Year select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                        emc.AddItem(media.Path);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerYear4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in yearListBox4.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Tag.Year == media.Tag.Year select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistArtist4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.artistListBox4.SelectedItems == null)
                return;

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
                {
                    foreach (MediaFile selectedMedia in this.artistListBox4.SelectedItems)
                    {
                        Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist select media);

                        foreach (MediaFile item in mediaItems)
                            mediaCollection.AddItem(item);
                    }
                }
                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistArtist4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
            {
                foreach (MediaFile selectedMedia in this.artistListBox4.SelectedItems)
                {
                    Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist select media);

                    foreach (MediaFile item in mediaItems)
                        newPlaylistMedia.AddItem(item);
                }
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingArtist4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
            {
                foreach (MediaFile selectedMedia in this.artistListBox4.SelectedItems)
                {
                    if (selectedMedia == null)
                        return;

                    npc.AddItems(new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist select media));
                }
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingArtist4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            npc.ClearItems();

            foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
            {
                foreach (MediaFile selectedMedia in this.artistListBox4.SelectedItems)
                {
                    if (selectedMedia == null)
                        return;

                    npc.AddItems(new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist select media));
                }
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryArtist4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
                {
                    foreach (MediaFile selectedMedia in this.artistListBox4.SelectedItems)
                    {
                        Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist select media);

                        foreach (MediaFile media in mediaItems)
                        {
                            musicCollection.RemoveItem(media);
                            ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                            emc.AddItem(media.Path);
                        }
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerArtist4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {

                foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
                {
                    foreach (MediaFile selectedMedia in this.artistListBox4.SelectedItems)
                    {
                        Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedMedia.Tag.AlbumArtist select media);

                        foreach (MediaFile media in mediaItems)
                        {
                            musicCollection.RemoveItem(media);
                            FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                        }
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistAlbum4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox4.SelectedItems == null)
                return;

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
                {
                    foreach (MediaFile selectedArtist in this.artistListBox4.SelectedItems)
                    {
                        foreach (MediaFile selectedAlbum in this.albumListBox4.SelectedItems)
                        {
                            Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media);

                            foreach (MediaFile item in mediaItems)
                                mediaCollection.AddItem(item);
                        }
                    }
                }
                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistAlbum4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox4.SelectedItems)
                {
                    foreach (MediaFile selectedAlbum in this.albumListBox4.SelectedItems)
                    {
                        Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media);

                        foreach (MediaFile item in mediaItems)
                            newPlaylistMedia.AddItem(item);
                    }
                }
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingAlbum4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox4.SelectedItems)
                {
                    foreach (MediaFile selectedAlbum in this.albumListBox4.SelectedItems)
                        npc.AddItems(new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media));
                }
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingAlbum4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            npc.ClearItems();

            foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox4.SelectedItems)
                {
                    foreach (MediaFile selectedAlbum in this.albumListBox4.SelectedItems)
                        npc.AddItems(new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media));
                }
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryAlbum4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
                {
                    foreach (MediaFile selectedArtist in this.artistListBox4.SelectedItems)
                    {
                        foreach (MediaFile selectedAlbum in this.albumListBox4.SelectedItems)
                        {
                            Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media);

                            foreach (MediaFile media in mediaItems)
                            {
                                musicCollection.RemoveItem(media);
                                ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                                emc.AddItem(media.Path);
                            }
                        }
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerAlbum4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile selectedYear in this.yearListBox4.SelectedItems)
                {
                    foreach (MediaFile selectedArtist in this.artistListBox4.SelectedItems)
                    {
                        foreach (MediaFile selectedAlbum in this.albumListBox4.SelectedItems)
                        {
                            Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Year == selectedYear.Tag.Year && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media);

                            foreach (MediaFile media in mediaItems)
                            {
                                musicCollection.RemoveItem(media);
                                FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                            }
                        }
                    }
                }

                BindContent();
            }

            Unpause();
        }
        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistTrack4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox4.SelectedItems == null)
                return;

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile selectedTrack in this.trackListBox4.SelectedItems)
                {
                    Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                    foreach (MediaFile item in mediaItems)
                        mediaCollection.AddItem(item);
                }

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistTrack4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedTrack in this.trackListBox4.SelectedItems)
            {
                Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                foreach (MediaFile item in mediaItems)
                    newPlaylistMedia.AddItem(item);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingTrack4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            foreach (MediaFile selectedTrack in this.trackListBox4.SelectedItems)
                npc.AddItem(selectedTrack);

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingTrack4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            npc.ClearItems();

            foreach (MediaFile selectedTrack in this.trackListBox4.SelectedItems)
                npc.AddItem(selectedTrack);

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryTrack4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {                
                foreach (MediaFile selectedTrack in this.trackListBox4.SelectedItems)
                {
                    Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                    foreach (MediaFile media in mediaItems)
                    {
                        musicCollection.RemoveItem(media);
                        ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                        emc.AddItem(media.Path);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerTrack4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {               
                foreach (MediaFile selectedTrack in this.trackListBox4.SelectedItems)
                {
                    Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                    foreach (MediaFile media in mediaItems)
                    {
                        musicCollection.RemoveItem(media);
                        FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    }
                }

                BindContent();
            }

            Unpause();
        }

#endregion

#region YearTag

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void editArtistInformation4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.artistListBox4.SelectedItems == null)
                return;

            Collection<MediaFile> mediaToEdit = new Collection<MediaFile>();

            foreach (MediaFile yearMedia in this.yearListBox4.SelectedItems)
            {
                foreach (MediaFile artistMedia in this.artistListBox4.SelectedItems)
                    mediaToEdit.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.AlbumArtist == artistMedia.Tag.AlbumArtist && a.Tag.Year == yearMedia.Tag.Year select a));
            }

            ArtistTagEditorWindow atew = new ArtistTagEditorWindow(mediaToEdit);
            if (atew.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editAlbumInformation4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();
            
            if (this.albumListBox4.SelectedItems == null)
                return;

            Collection<MediaFile> editAlbumMedia = new Collection<MediaFile>();

            if (this.artistListBox4.SelectedItems.Count < 1)
                return;

            foreach (MediaFile yearMedia in this.yearListBox4.SelectedItems)
            {
                foreach (MediaFile artistMedia in this.artistListBox4.SelectedItems)
                {
                    foreach (MediaFile albumMedia in this.albumListBox4.SelectedItems)
                        editAlbumMedia.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.AlbumArtist == artistMedia.Tag.AlbumArtist && a.Tag.Year == yearMedia.Tag.Year && a.Tag.Album == albumMedia.Tag.Album select a));
                }
            }

            AlbumTagEditorWindow ate = new AlbumTagEditorWindow(editAlbumMedia);
            if (ate.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editTrackInformation4_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox4.SelectedItems == null)
                return;

            Collection<MediaFile> editAlbumMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.trackListBox4.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                editAlbumMedia.AddItem(selectedMedia);
            }

            SongTagEditorWindow stew = new SongTagEditorWindow(editAlbumMedia);
            if (stew.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

#endregion

#region Genre

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void genreListBox5_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pause();

            if (this.genreListBox5.SelectedItems == null)
                return;

            Collection<MediaFile> media = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.genreListBox5.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                foreach (MediaFile item in (from artist in musicCollection where artist.Tag.Genre == selectedMedia.Tag.Genre select artist).Distinct(new MediaArtistEqualityComparer()))
                    media.AddItem(item);
            }

            this.artistListBox5.ItemsSource = media;

            if (this.artistListBox5.Items.Count > 0)
                this.artistListBox5.SelectedIndex = 0;

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void artistListBox5_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pause();

            if (this.artistListBox5.SelectedItems == null)
                return;

            Collection<MediaFile> selectedItems = new Collection<MediaFile>();

            foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                {
                    foreach (MediaFile item in (from artist in musicCollection where artist.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && artist.Tag.Genre == selectedGenre.Tag.Genre select artist).Distinct(new MediaGenreEqualityComparer()))
                        selectedItems.AddItem(item);
                }
            }

            this.albumListBox5.ItemsSource = selectedItems;

            if (this.albumListBox5.Items.Count > 0)
                this.albumListBox5.SelectedIndex = 0;

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void albumListBox5_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pause();

            if (this.albumListBox5.SelectedItems == null)
                return;

            Collection<MediaFile> selectedItems = new Collection<MediaFile>();

            foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                {
                    foreach (MediaFile selectedAlbum in this.albumListBox5.SelectedItems)
                    {
                        foreach (MediaFile item in (from song in musicCollection where song.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && song.Tag.Album == selectedAlbum.Tag.Album && song.Tag.Genre == selectedGenre.Tag.Genre select song).Distinct())
                            selectedItems.AddItem(item);
                    }
                }
            }
            this.trackListBox5.ItemsSource = selectedItems;

            if (this.trackListBox5.Items.Count > 0)
                this.trackListBox5.SelectedIndex = 0;

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trackListBox5_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistGenre5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;

                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile selectedMedia in this.genreListBox5.SelectedItems)
                {
                    var mediaItems = (from media in musicCollection where media.Tag.Genre == selectedMedia.Tag.Genre select media);

                    foreach (MediaFile item in mediaItems)
                        mediaCollection.AddItem(item);
                }

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistGenre5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.genreListBox5.SelectedItems)
            {
                var mediaItems = (from media in musicCollection where media.Tag.Genre == selectedMedia.Tag.Genre select media);

                foreach (MediaFile item in mediaItems)
                    newPlaylistMedia.AddItem(item);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingGenre5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            foreach (MediaFile selectedMedia in this.genreListBox5.SelectedItems)
                npc.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.Genre == selectedMedia.Tag.Genre select a));

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingGenre5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            npc.ClearItems();

            foreach (MediaFile selectedMedia in this.genreListBox5.SelectedItems)
                npc.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.Genre == selectedMedia.Tag.Genre select a));

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryGenre5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in this.genreListBox5.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Tag.Genre == media.Tag.Genre select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                        emc.AddItem(media.Path);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerGenre5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in genreListBox5.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Tag.Genre == media.Tag.Genre select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistArtist5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
                {
                    foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                    {
                        Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist select media);

                        foreach (MediaFile item in mediaItems)
                            mediaCollection.AddItem(item);
                    }
                }
                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistArtist5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                {
                    Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist select media);

                    foreach (MediaFile item in mediaItems)
                        newPlaylistMedia.AddItem(item);
                }
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingArtist5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                    npc.AddItems(new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist select media));
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingArtist5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            npc.ClearItems();

            foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                    npc.AddItems(new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist select media));
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryArtist5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
                {
                    foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                    {
                        Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist select media);

                        foreach (MediaFile media in mediaItems)
                        {
                            musicCollection.RemoveItem(media);
                            ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                            emc.AddItem(media.Path);
                        }
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerArtist5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
                {
                    foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                    {
                        Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist select media);

                        foreach (MediaFile media in mediaItems)
                        {
                            musicCollection.RemoveItem(media);
                            FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                        }
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistAlbum5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
                {
                    foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                    {
                        foreach (MediaFile selectedAlbum in this.albumListBox5.SelectedItems)
                        {
                            Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media);

                            foreach (MediaFile item in mediaItems)
                                mediaCollection.AddItem(item);
                        }
                    }
                }
                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistAlbum5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                {
                    foreach (MediaFile selectedAlbum in this.albumListBox5.SelectedItems)
                    {
                        Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media);

                        foreach (MediaFile item in mediaItems)
                            newPlaylistMedia.AddItem(item);
                    }
                }
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingAlbum5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                {
                    foreach (MediaFile selectedAlbum in this.albumListBox5.SelectedItems)
                        npc.AddItems(new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media));
                }
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingAlbum5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            npc.ClearItems();

            foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
            {
                foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                {
                    foreach (MediaFile selectedAlbum in this.albumListBox5.SelectedItems)
                        npc.AddItems(new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media));
                }
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryAlbum5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
                {
                    foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                    {
                        foreach (MediaFile selectedAlbum in this.albumListBox5.SelectedItems)
                        {
                            Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media);

                            foreach (MediaFile media in mediaItems)
                            {
                                musicCollection.RemoveItem(media);
                                ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                                emc.AddItem(media.Path);
                            }
                        }
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerAlbum5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile selectedGenre in this.genreListBox5.SelectedItems)
                {
                    foreach (MediaFile selectedArtist in this.artistListBox5.SelectedItems)
                    {
                        foreach (MediaFile selectedAlbum in this.albumListBox5.SelectedItems)
                        {
                            Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Tag.Genre == selectedGenre.Tag.Genre && media.Tag.AlbumArtist == selectedArtist.Tag.AlbumArtist && media.Tag.Album == selectedAlbum.Tag.Album select media);

                            foreach (MediaFile media in mediaItems)
                            {
                                musicCollection.RemoveItem(media);
                                FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                            }
                        }
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistTrack5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile selectedTrack in this.trackListBox5.SelectedItems)
                {
                    Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                    foreach (MediaFile item in mediaItems)
                        mediaCollection.AddItem(item);
                }

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistTrack5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedTrack in this.trackListBox5.SelectedItems)
            {
                Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                foreach (MediaFile item in mediaItems)
                    newPlaylistMedia.AddItem(item);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingTrack5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            foreach (MediaFile selectedTrack in this.trackListBox5.SelectedItems)
                npc.AddItem(selectedTrack);

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingTrack5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            npc.ClearItems();

            if (this.yearListBox4.SelectedItems == null)
                return;

            foreach (MediaFile selectedTrack in this.trackListBox5.SelectedItems)
                npc.AddItem(selectedTrack);

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryTrack5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile selectedTrack in this.trackListBox5.SelectedItems)
                {
                    Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                    foreach (MediaFile media in mediaItems)
                    {
                        musicCollection.RemoveItem(media);
                        ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                        emc.AddItem(media.Path);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerTrack5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.yearListBox4.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile selectedTrack in this.trackListBox5.SelectedItems)
                {
                    Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                    foreach (MediaFile media in mediaItems)
                    {
                        musicCollection.RemoveItem(media);
                        FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    }
                }

                BindContent();
            }

            Unpause();
        }

#endregion

#region GenreTag

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void editArtistInformation5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.artistListBox5.SelectedItems == null)
                return;

            Collection<MediaFile> mediaToEdit = new Collection<MediaFile>();

            foreach (MediaFile genreMedia in this.genreListBox5.SelectedItems)
            {
                foreach (MediaFile artistMedia in this.artistListBox5.SelectedItems)
                    mediaToEdit.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.AlbumArtist == artistMedia.Tag.AlbumArtist select a));
            }

            ArtistTagEditorWindow atew = new ArtistTagEditorWindow(mediaToEdit);
            if (atew.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editAlbumInformation5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.albumListBox5.SelectedItems == null)
                return;

            Collection<MediaFile> editAlbumMedia = new Collection<MediaFile>();

            if (this.artistListBox5.SelectedItems.Count < 1)
                return;

            foreach (MediaFile genreMedia in this.genreListBox5.SelectedItems)
            {
                foreach (MediaFile artistMedia in this.artistListBox5.SelectedItems)
                {
                    foreach (MediaFile albumMedia in this.artistListBox5.SelectedItems)
                        editAlbumMedia.AddItems(new Collection<MediaFile>(from a in musicCollection where a.Tag.Album == albumMedia.Tag.Album && a.Tag.AlbumArtist == artistMedia.Tag.AlbumArtist && a.Tag.Genre == genreMedia.Tag.Genre select a));
                }
            }

            AlbumTagEditorWindow ate = new AlbumTagEditorWindow(editAlbumMedia);
            if (ate.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editTrackInformation5_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox5.SelectedItems == null)
                return;

            Collection<MediaFile> editAlbumMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.trackListBox5.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                editAlbumMedia.AddItem(selectedMedia);
            }

            SongTagEditorWindow stew = new SongTagEditorWindow(editAlbumMedia);
            if (stew.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

#endregion

#region TreeView
        
        /// <summary>
        /// 
        /// </summary>
        private void BuildTree()
        {
            Pause();

            musicTreeView.Items.Clear();
            musicTreeView.Items.Refresh();

            foreach (string path in Settings.MusicWatchFolders)
            {
                try
                {
                    if (path != string.Empty)
                    {
                        TreeViewItem item = new TreeViewItem();
                        item.Header = path;
                        item.Tag = path;
                        item.Items.Add(defaultNode);
                        item.Expanded += new RoutedEventHandler(folder_Expanded);

                        musicTreeView.Items.Add(item);
                    }
                }
                catch
                {
                }
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void folder_Expanded(object sender, RoutedEventArgs e)
        {
            Pause();

            TreeViewItem item = (TreeViewItem)sender;
            if (item == null)
                return;

            if (item.Items.Count == 1 && item.Items[0] == defaultNode)
            {
                item.Items.Clear();

                try
                {
                    foreach (string s in Directory.GetDirectories(item.Tag.ToString()))
                    {
                        TreeViewItem subitem = new TreeViewItem();
                        subitem.Header = s.Substring(s.LastIndexOf("\\") + 1);
                        subitem.Tag = s;
                        subitem.FontWeight = FontWeights.Normal;
                        subitem.Items.Add(defaultNode);
                        subitem.Expanded += new RoutedEventHandler(folder_Expanded);

                        item.Items.Add(subitem);
                    }
                }
                catch
                {

                }
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void musicTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            Pause();

            if (musicTreeView.SelectedItem == null)
                return;

            try
            {
                this.trackListBox6.ItemsSource = (from m in musicCollection where m.Path.Contains(((TreeViewItem)musicTreeView.SelectedItem).Tag.ToString()) orderby m.Path select m);

                if (this.trackListBox6.Items.Count > 0)
                    this.trackListBox6.SelectedIndex = 0;
            }
            catch
            {
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void addToNowPlayingTree6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            TreeViewItem selectedItem = (TreeViewItem)musicTreeView.SelectedItem;

            if (selectedItem == null)
                return;

            Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where media.Path.Contains(selectedItem.Tag.ToString()) orderby media.Path select media);

            foreach (MediaFile selectedTrack in selectedMedia)
                npc.AddItem(selectedTrack);

            Unpause();
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void replaceNowPlayingTree6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            TreeViewItem selectedItem = (TreeViewItem)musicTreeView.SelectedItem;

            if (selectedItem == null)
                return;

            npc.ClearItems();

            Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where media.Path.Contains(selectedItem.Tag.ToString()) orderby media.Path select media);

            foreach (MediaFile selectedTrack in selectedMedia)
                npc.AddItem(selectedTrack);

            Unpause();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void addToNewPlaylistTree6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            TreeViewItem selectedItem = (TreeViewItem)musicTreeView.SelectedItem;

            if (selectedItem == null)
                return;

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>(from media in musicCollection where media.Path.Contains(selectedItem.Tag.ToString()) orderby media.Path select media);
            
            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void addToPlaylistTree6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            TreeViewItem selectedItem = (TreeViewItem)musicTreeView.SelectedItem;

            if (selectedItem == null)
                return;

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>(from media in musicCollection where media.Path.Contains(selectedItem.Tag.ToString()) orderby media.Path select media);

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void deleteFromLibraryTree6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            TreeViewItem selectedItem = (TreeViewItem)musicTreeView.SelectedItem;

            if (selectedItem == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>(from media in musicCollection where media.Path.Contains(selectedItem.Tag.ToString()) orderby media.Path select media);

                foreach (MediaFile media in mediaCollection)
                {
                    musicCollection.RemoveItem(media);
                    ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                    emc.AddItem(media.Path);
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void deleteFromLibraryComputerTree6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            TreeViewItem selectedItem = (TreeViewItem)musicTreeView.SelectedItem;

            if (selectedItem == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>(from media in musicCollection where media.Path.Contains(selectedItem.Tag.ToString()) orderby media.Path select media);

                foreach (MediaFile media in mediaCollection)
                {
                    musicCollection.RemoveItem(media);
                    FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void addToNowPlayingTrack6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            foreach (MediaFile selectedTrack in this.trackListBox6.SelectedItems)
                npc.AddItem(selectedTrack);

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void replaceNowPlayingTrack6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            npc.ClearItems();

            foreach (MediaFile selectedTrack in this.trackListBox6.SelectedItems)
                npc.AddItem(selectedTrack);

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void addToNewPlaylistTrack6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedTrack in this.trackListBox6.SelectedItems)
            {
                Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                foreach (MediaFile item in mediaItems)
                    newPlaylistMedia.AddItem(item);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void addToPlaylistTrack6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;
                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile selectedTrack in this.trackListBox6.SelectedItems)
                {
                    Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                    foreach (MediaFile item in mediaItems)
                        mediaCollection.AddItem(item);
                }

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryTrack6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile selectedTrack in this.trackListBox6.SelectedItems)
                {
                    Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                    foreach (MediaFile media in mediaItems)
                    {
                        musicCollection.RemoveItem(media);
                        ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                        emc.AddItem(media.Path);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerTrack6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile selectedTrack in this.trackListBox6.SelectedItems)
                {
                    Collection<MediaFile> mediaItems = new Collection<MediaFile>(from media in musicCollection where media.Path == selectedTrack.Path select media);

                    foreach (MediaFile media in mediaItems)
                    {
                        musicCollection.RemoveItem(media);
                        FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    }
                }

                BindContent();
            }

            Unpause();
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void musicListBox_SelectionChanged(object sender, RoutedEventArgs e)
        {
        }

#endregion

#region TreeViewTag

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editTrackInformation6_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox6.SelectedItems == null)
                return;

            Collection<MediaFile> editAlbumMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.trackListBox6.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                editAlbumMedia.AddItem(selectedMedia);
            }

            SongTagEditorWindow stew = new SongTagEditorWindow(editAlbumMedia);
            if (stew.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }

#endregion

#region RecentlyAdded
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trackListBox7_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNowPlayingTrack7_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox3.SelectedItems == null)
                return;

            foreach (MediaFile selectedMedia in this.trackListBox7.SelectedItems)
                npc.AddItem(selectedMedia);

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void replaceNowPlayingTrack7_OnClick(object sender, RoutedEventArgs e)
        {
            if (this.trackListBox7.SelectedItems == null)
                return;

            Pause();

            npc.ClearItems();

            foreach (MediaFile selectedMedia in this.trackListBox7.SelectedItems)
                npc.AddItem(selectedMedia);

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToPlaylistTrack7_OnClick(object sender, RoutedEventArgs e)
        {
            if (trackListBox3.SelectedItems == null)
                return;

            Pause();

            PlaylistSelectionWindow psw = new PlaylistSelectionWindow();

            if (psw.ShowDialog().Value == true)
            {
                Playlist playlist = psw.SelectedPlaylist;

                Collection<MediaFile> mediaCollection = new Collection<MediaFile>();

                foreach (MediaFile media in trackListBox7.SelectedItems)
                    mediaCollection.AddItem(media);

                Playlist.AddItems(playlist.Path, mediaCollection);
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToNewPlaylistTrack7_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            Collection<MediaFile> newPlaylistMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.trackListBox7.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                newPlaylistMedia.AddItem(selectedMedia);
            }

            NewPlaylistWindow npw = new NewPlaylistWindow(newPlaylistMedia);

            if (npw.ShowDialog().Value == true)
            {
                PlaylistCollection playlistCollection = PlaylistCollection.GetPlaylistCollection();
                playlistCollection.AddItem(new Playlist() { Path = npw.PlaylistPath, Title = System.IO.Path.GetFileName(npw.PlaylistPath) });
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryTrack7_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox7.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will be added to the Excluded Media List)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in this.trackListBox7.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Path == media.Path select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        ExcludedMediaCollection emc = ExcludedMediaCollection.GetExcludedMediaCollection();
                        emc.AddItem(media.Path);
                    }
                }

                BindContent();
            }

            Unpause();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteFromLibraryComputerTrack7_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox3.SelectedItems == null)
                return;

            if (MessageBox.Show("Delete media from library? (Files will moved to your Recycle Bin)", "Confirm Media Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                foreach (MediaFile item in trackListBox7.SelectedItems)
                {
                    Collection<MediaFile> selectedMedia = new Collection<MediaFile>(from media in musicCollection where item.Path == media.Path select media);

                    foreach (MediaFile media in selectedMedia)
                    {
                        musicCollection.RemoveItem(media);
                        FileSystem.DeleteFile(media.Path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
                    }
                }

                BindContent();
            }

            Unpause();
        }
#endregion

#region SongTag
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editTrackInformation7_OnClick(object sender, RoutedEventArgs e)
        {
            Pause();

            if (this.trackListBox3.SelectedItems == null)
                return;

            Collection<MediaFile> editAlbumMedia = new Collection<MediaFile>();

            foreach (MediaFile selectedMedia in this.trackListBox7.SelectedItems)
            {
                if (selectedMedia == null)
                    return;

                editAlbumMedia.AddItem(selectedMedia);
            }

            SongTagEditorWindow stew = new SongTagEditorWindow(editAlbumMedia);
            if (stew.ShowDialog().Value == true)
            {
                Unpause();
                BindContent();
            }

            Unpause();
        }
#endregion
    }
}
